<?php
class Sub extends CI_Model {
	
	public function __construct(){
		$this->load->database();
		$this->load->library('factory');
		$this->factory->create('SubTO');
	}
	
	public function saveSub($sub){
		//var_dump($sub);
		$sql = "INSERT INTO sub VALUES ('','".$sub->getEmail()."','')";
		//echo $sql;
		$query = $this->db->query($sql);
		
	   
	}
	
	public function exist($sub){
		$sql = "SELECT COUNT(*) as br FROM sub WHERE email='".$sub->getEmail()."  '";
		$query = $this->db->query($sql);
		//var_dump($query->result()[0]->br);
		if ($query->result()[0]->br>0)
		{
			return false;
		}		
		return true;
		
	}
	
}